<!DOCTYPE html>
<html>
<head>
  <meta charset="utf-8">
  
  <title>云飞扬 - 个人博客</title>
  <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
  <meta property="og:type" content="website">
<meta property="og:title" content="云飞扬 - 个人博客">
<meta property="og:url" content="http://blog.yxxit.com/index.html">
<meta property="og:site_name" content="云飞扬 - 个人博客">
<meta name="twitter:card" content="summary">
<meta name="twitter:title" content="云飞扬 - 个人博客">
  
    <link rel="alternate" href="/atom.xml" title="云飞扬 - 个人博客" type="application/atom+xml">
  
  
    <link rel="icon" href="/view/favicon.ico">
  
  
    <link href="//fonts.googleapis.com/css?family=Source+Code+Pro" rel="stylesheet" type="text/css">
  
  <link rel="stylesheet" href="/view/css/style.css">
  

</head>

<body>
  <div id="container">
    <div id="wrap">
      <header id="header">
  <div id="banner"></div>
  <div id="header-outer" class="outer">
    <div id="header-title" class="inner">
      <h1 id="logo-wrap">
        <a href="/view/" id="logo">云飞扬 - 个人博客</a>
      </h1>
      
    </div>
    <div id="header-inner" class="inner">
      <nav id="main-nav">
        <a id="main-nav-toggle" class="nav-icon"></a>
        
          <a class="main-nav-link" href="/view/">Home</a>
        
          <a class="main-nav-link" href="/view/archives">Archives</a>
        
      </nav>
      <nav id="sub-nav">
        
          <a id="nav-rss-link" class="nav-icon" href="/atom.xml" title="RSS Feed"></a>
        
        <a id="nav-search-btn" class="nav-icon" title="Search"></a>
      </nav>
      <div id="search-form-wrap">
        <form action="//google.com/search" method="get" accept-charset="UTF-8" class="search-form"><input type="search" name="q" results="0" class="search-form-input" placeholder="Search"><button type="submit" class="search-form-submit">&#xF002;</button><input type="hidden" name="sitesearch" value="http://blog.yxxit.com"></form>
      </div>
    </div>
  </div>
</header>
      <div class="outer">
        <section id="main">
  
    <article id="post-npm" class="article article-type-post" itemscope itemprop="blogPost">
  <div class="article-meta">
    <a href="/view/2017/03/21/npm/" class="article-date">
  <time datetime="2017-03-21T00:43:59.685Z" itemprop="datePublished">2017-03-21</time>
</a>
    
  </div>
  <div class="article-inner">
    
    
      <header class="article-header">
        
  
    <h1 itemprop="name">
      <a class="article-title" href="/view/2017/03/21/npm/">npm 常用命令</a>
    </h1>
  

      </header>
    
    <div class="article-entry" itemprop="articleBody">
      
        <h2 id="简介NPM-Node-Package-Manger"><a href="#简介NPM-Node-Package-Manger" class="headerlink" title="简介NPM(Node Package Manger)"></a>简介NPM(Node Package Manger)</h2><blockquote>
<p>NPM是随同NodeJS一起安装的包管理工具，能解决NodeJS代码部署上的很多问题，常见的使用场景有以下几种：</p>
<ol>
<li>允许用户从NPM服务器下载别人编写的第三方包到本地使用。</li>
<li>允许用户从NPM服务器下载并安装别人编写的命令行程序到本地使用。</li>
<li>允许用户将自己编写的包或命令行程序上传到NPM服务器供别人使用。<h2 id="npm-安装"><a href="#npm-安装" class="headerlink" title="npm 安装"></a>npm 安装</h2></li>
</ol>
<ul>
<li>Windows 下，一般情况，安装node.js 的同时，npm 也会同时安装。</li>
<li>Ubuntu 下<figure class="highlight plain"><table><tr><td class="gutter"><pre><div class="line">1</div><div class="line">2</div><div class="line">3</div><div class="line">4</div><div class="line">5</div><div class="line">6</div><div class="line">7</div><div class="line">8</div></pre></td><td class="code"><pre><div class="line">sudo apt-get install curl</div><div class="line">curl http://npmjs.org/install.sh | sudo sh</div><div class="line">#或者</div><div class="line">sudo apt-get install npm</div><div class="line">#查看npm被安装到哪里</div><div class="line">whereis npm </div><div class="line">#设置成全局：</div><div class="line">ln -s [文件位置/npm]  /usr/local/bin/npm</div></pre></td></tr></table></figure>
</li>
</ul>
</blockquote>
<h2 id="配置镜像"><a href="#配置镜像" class="headerlink" title="配置镜像"></a>配置镜像</h2><figure class="highlight plain"><table><tr><td class="gutter"><pre><div class="line">1</div><div class="line">2</div><div class="line">3</div></pre></td><td class="code"><pre><div class="line">npm install -g cnpm --registry=https://registry.npm.taobao.org</div><div class="line">npm install  --registry=https://registry.npm.taobao.org</div><div class="line">npm config set registry http://registry.npmjs.org/</div></pre></td></tr></table></figure>
<h2 id="npm-升级"><a href="#npm-升级" class="headerlink" title="npm 升级"></a>npm 升级</h2><figure class="highlight plain"><table><tr><td class="gutter"><pre><div class="line">1</div><div class="line">2</div></pre></td><td class="code"><pre><div class="line">npm -g install npm ( 最新稳定版 ) 或</div><div class="line">npm -g install npm@2.9.1 ( 指定版本 )</div></pre></td></tr></table></figure>
<h2 id="常用"><a href="#常用" class="headerlink" title="常用"></a>常用</h2><figure class="highlight plain"><table><tr><td class="gutter"><pre><div class="line">1</div><div class="line">2</div><div class="line">3</div><div class="line">4</div><div class="line">5</div></pre></td><td class="code"><pre><div class="line">npm install -g pm2</div><div class="line">npm install -g nodemon</div><div class="line">npm install -g vue-cli</div><div class="line">npm install -g  webpack</div><div class="line">npm i -g bower  ## 升级</div></pre></td></tr></table></figure>
<h2 id="常用命令"><a href="#常用命令" class="headerlink" title="常用命令"></a>常用命令</h2><p>安装必要依赖<br><figure class="highlight plain"><table><tr><td class="gutter"><pre><div class="line">1</div></pre></td><td class="code"><pre><div class="line">npm install --production</div></pre></td></tr></table></figure></p>
<p>安装开发依赖<br><figure class="highlight plain"><table><tr><td class="gutter"><pre><div class="line">1</div></pre></td><td class="code"><pre><div class="line">npm install --dev</div></pre></td></tr></table></figure></p>
<p>安装全部依赖<br><figure class="highlight plain"><table><tr><td class="gutter"><pre><div class="line">1</div></pre></td><td class="code"><pre><div class="line">npm install</div></pre></td></tr></table></figure></p>
<h4 id="全局安装辅助模块"><a href="#全局安装辅助模块" class="headerlink" title="全局安装辅助模块"></a>全局安装辅助模块</h4><figure class="highlight plain"><table><tr><td class="gutter"><pre><div class="line">1</div><div class="line">2</div><div class="line">3</div></pre></td><td class="code"><pre><div class="line">$ npm install pm2 -g # 命令行安装 pm2</div><div class="line">npm install -g cnpm  # 国内开发必用</div><div class="line">npm install -g nodemon</div></pre></td></tr></table></figure>
<h4 id="安装并更新package-json中的版本配置"><a href="#安装并更新package-json中的版本配置" class="headerlink" title="安装并更新package.json中的版本配置"></a>安装并更新package.json中的版本配置</h4><ul>
<li>添加–save 参数安装的模块的名字及其版本信息会出现在package.json的dependencies选项中</li>
<li>添加–save-dev 参数安装的模块的名字及其版本信息会出现在package.json的devDependencies选项中</li>
<li>添加–save-optional 参数安装的模块的名字及其版本信息会出现在package.json的optionalDependencies选项中<figure class="highlight plain"><table><tr><td class="gutter"><pre><div class="line">1</div></pre></td><td class="code"><pre><div class="line">npm install &lt;name&gt; [–save|–save-dev|–save-optional]</div></pre></td></tr></table></figure>
</li>
</ul>
<h4 id="安装模块的config的tag配置中含有指定tag的版本"><a href="#安装模块的config的tag配置中含有指定tag的版本" class="headerlink" title="安装模块的config的tag配置中含有指定tag的版本"></a>安装模块的config的tag配置中含有指定tag的版本</h4><figure class="highlight plain"><table><tr><td class="gutter"><pre><div class="line">1</div><div class="line">2</div><div class="line">3</div><div class="line">4</div><div class="line">5</div></pre></td><td class="code"><pre><div class="line">npm install &lt;name&gt;@&lt;tag&gt;</div><div class="line">Example:</div><div class="line">npm install sax@latest</div><div class="line">安装模块的指定版本</div><div class="line">npm install &lt;name&gt;@&lt;version&gt;</div></pre></td></tr></table></figure>
<h4 id="显示npm的bin目录"><a href="#显示npm的bin目录" class="headerlink" title="显示npm的bin目录"></a>显示npm的bin目录</h4><figure class="highlight plain"><table><tr><td class="gutter"><pre><div class="line">1</div></pre></td><td class="code"><pre><div class="line">npm bin</div></pre></td></tr></table></figure>
<h4 id="设置npm配置"><a href="#设置npm配置" class="headerlink" title="设置npm配置"></a>设置npm配置</h4><figure class="highlight plain"><table><tr><td class="gutter"><pre><div class="line">1</div></pre></td><td class="code"><pre><div class="line">npm config set &lt;key&gt; &lt;value&gt; [–global]</div></pre></td></tr></table></figure>
<p>使用–global参数，设置全局配置<br>Example:<br>设置代理<br><figure class="highlight plain"><table><tr><td class="gutter"><pre><div class="line">1</div></pre></td><td class="code"><pre><div class="line">npm config set proxy=http://proxy.tencent.com:8080</div></pre></td></tr></table></figure></p>
<h4 id="设置npm的镜像地址"><a href="#设置npm的镜像地址" class="headerlink" title="设置npm的镜像地址"></a>设置npm的镜像地址</h4><figure class="highlight plain"><table><tr><td class="gutter"><pre><div class="line">1</div></pre></td><td class="code"><pre><div class="line">npm config set registry http://npm.oa.com</div></pre></td></tr></table></figure>
<p>获取npm配置<br>npm config get <key><br>Example:</key></p>
<h4 id="获取npm当前镜像地址"><a href="#获取npm当前镜像地址" class="headerlink" title="获取npm当前镜像地址"></a>获取npm当前镜像地址</h4><figure class="highlight plain"><table><tr><td class="gutter"><pre><div class="line">1</div></pre></td><td class="code"><pre><div class="line">npm config get registory</div></pre></td></tr></table></figure>
<h4 id="删除npm配置"><a href="#删除npm配置" class="headerlink" title="删除npm配置"></a>删除npm配置</h4><figure class="highlight plain"><table><tr><td class="gutter"><pre><div class="line">1</div></pre></td><td class="code"><pre><div class="line">npm config delete &lt;key&gt;</div></pre></td></tr></table></figure>
<p>Example:</p>
<h4 id="删除代理设置"><a href="#删除代理设置" class="headerlink" title="删除代理设置"></a>删除代理设置</h4><figure class="highlight plain"><table><tr><td class="gutter"><pre><div class="line">1</div></pre></td><td class="code"><pre><div class="line">npm config delete proxy</div></pre></td></tr></table></figure>
<h4 id="在编辑器中打开npm配置文件"><a href="#在编辑器中打开npm配置文件" class="headerlink" title="在编辑器中打开npm配置文件"></a>在编辑器中打开npm配置文件</h4><figure class="highlight plain"><table><tr><td class="gutter"><pre><div class="line">1</div></pre></td><td class="code"><pre><div class="line">npm config edit</div></pre></td></tr></table></figure>
<h4 id="交互式的创建package-json文件"><a href="#交互式的创建package-json文件" class="headerlink" title="交互式的创建package.json文件"></a>交互式的创建package.json文件</h4><figure class="highlight plain"><table><tr><td class="gutter"><pre><div class="line">1</div></pre></td><td class="code"><pre><div class="line">npm init</div></pre></td></tr></table></figure>
<h4 id="创建模块的压缩包"><a href="#创建模块的压缩包" class="headerlink" title="创建模块的压缩包"></a>创建模块的压缩包</h4><figure class="highlight plain"><table><tr><td class="gutter"><pre><div class="line">1</div></pre></td><td class="code"><pre><div class="line">npm pack [&lt;pkg&gt; [&lt;pkg&gt; … ]]</div></pre></td></tr></table></figure>
<p>如果没有参数，则npm会打包当前模块目录<br>发布模块，发布后可通过名称来安装该模块<br><figure class="highlight plain"><table><tr><td class="gutter"><pre><div class="line">1</div><div class="line">2</div></pre></td><td class="code"><pre><div class="line">npm publish &lt;tarball&gt;</div><div class="line">npm publish &lt;folder&gt;</div></pre></td></tr></table></figure></p>
<p>其中：</p>
<p><folder>：包含package.json文件的目录</folder></p>
<p><tarball>：经过gzip压缩并归档的一个URL或文件路径，该压缩包包含单个目录，且该目录内有package.json文件</tarball></p>
<h4 id="删除模块"><a href="#删除模块" class="headerlink" title="删除模块"></a>删除模块</h4><figure class="highlight plain"><table><tr><td class="gutter"><pre><div class="line">1</div><div class="line">2</div><div class="line">3</div><div class="line">4</div></pre></td><td class="code"><pre><div class="line">npm rm &lt;name&gt;</div><div class="line">npm r &lt;name&gt;</div><div class="line">npm uninstall &lt;name&gt;</div><div class="line">npm un &lt;name&gt;</div></pre></td></tr></table></figure>
<p>注意：不会删除package.json文件dependencies选项中对应的依赖配置</p>
<h4 id="查找模块"><a href="#查找模块" class="headerlink" title="查找模块"></a>查找模块</h4><figure class="highlight plain"><table><tr><td class="gutter"><pre><div class="line">1</div><div class="line">2</div><div class="line">3</div></pre></td><td class="code"><pre><div class="line">npm search [search terms ..]</div><div class="line">npm s [search terms ..]</div><div class="line">npm se [search terms ..]</div></pre></td></tr></table></figure>
<p>查找匹配查找字符串的模块</p>
<h4 id="更新模块"><a href="#更新模块" class="headerlink" title="更新模块"></a>更新模块</h4><figure class="highlight plain"><table><tr><td class="gutter"><pre><div class="line">1</div></pre></td><td class="code"><pre><div class="line">npm update [-g] [&lt;name&gt; [&lt;name&gt; … ]]</div></pre></td></tr></table></figure>
<p>更新指定name列表中的模块。-g参数更新全局安装的模块。<br>如果没有指定name，且不是在某个模块内，会更新当前目录依赖的所有包都会被更新（包括全局和模块内）；如果当前目录在某个模块目录内，会更新该模块依赖的模块，所以不指定name直接运行npm update时，最好在某个模块内运行，以免更新到其他不想更新的模块。</p>
<h4 id="执行脚本"><a href="#执行脚本" class="headerlink" title="执行脚本"></a>执行脚本</h4><figure class="highlight plain"><table><tr><td class="gutter"><pre><div class="line">1</div><div class="line">2</div><div class="line">3</div><div class="line">4</div></pre></td><td class="code"><pre><div class="line">npm start [&lt;name&gt;]</div><div class="line">npm stop [&lt;name&gt;]</div><div class="line">npm test [&lt;name&gt;]</div><div class="line">npm run [&lt;name&gt;]</div></pre></td></tr></table></figure>
<p>运行package的start脚本，该脚本写在package.json文件scripts的start字段中。<br>该字段的值可以是当前系统控制台可执行的脚本，也可以是当前系统可执行文件的路径。<br>如果不传name参数，则执行当前目录下package.json文件中定义的脚本。<br>详见<a href="https://npmjs.org/doc/misc/npm-scripts.html" target="_blank" rel="external">https://npmjs.org/doc/misc/npm-scripts.html</a></p>
<h4 id="package-json文件"><a href="#package-json文件" class="headerlink" title="package.json文件"></a>package.json文件</h4><p>模块的配置文件，详见<a href="https://npmjs.org/doc/files/package.json.html" target="_blank" rel="external">https://npmjs.org/doc/files/package.json.html</a></p>
<h2 id="发布项目到npm"><a href="#发布项目到npm" class="headerlink" title="发布项目到npm"></a>发布项目到npm</h2><ol>
<li>在<a href="https://www.npmjs.com/" target="_blank" rel="external">NPM官网</a>注册账号</li>
<li>用户验证，命令行执行</li>
</ol>
<figure class="highlight plain"><table><tr><td class="gutter"><pre><div class="line">1</div><div class="line">2</div><div class="line">3</div></pre></td><td class="code"><pre><div class="line">npm adduser</div><div class="line">npm login # 登录</div><div class="line">npm who am i</div></pre></td></tr></table></figure>
<ol>
<li><p>发布模块，在模块的根文件夹执行</p>
<figure class="highlight plain"><table><tr><td class="gutter"><pre><div class="line">1</div></pre></td><td class="code"><pre><div class="line">npm publish</div></pre></td></tr></table></figure>
</li>
<li><p>更新版本</p>
<blockquote>
<p>如果是git库时，会为新版本号创建一条提交信息，package版本号会自动递增。</p>
<figure class="highlight plain"><table><tr><td class="gutter"><pre><div class="line">1</div><div class="line">2</div></pre></td><td class="code"><pre><div class="line">npm version 0.0.4</div><div class="line">npm publish</div></pre></td></tr></table></figure>
</blockquote>
</li>
<li><p>将代码同步到github.com</p>
</li>
</ol>
<h2 id="npm常用命令"><a href="#npm常用命令" class="headerlink" title="npm常用命令"></a>npm常用命令</h2><figure class="highlight plain"><table><tr><td class="gutter"><pre><div class="line">1</div><div class="line">2</div><div class="line">3</div><div class="line">4</div><div class="line">5</div><div class="line">6</div></pre></td><td class="code"><pre><div class="line">npm search module_name 查找模块</div><div class="line">npm docs module_name 查找模块文档</div><div class="line">npm install 安装package.json指定的所有模块</div><div class="line">npm start</div><div class="line">npm test</div><div class="line">cnpm install gulp --save-dev</div></pre></td></tr></table></figure>
<h2 id="Package-json-属性说明"><a href="#Package-json-属性说明" class="headerlink" title="Package.json 属性说明"></a>Package.json 属性说明</h2><pre>
   name - 包名。
   version - 包的版本号。
   description - 包的描述。
   homepage - 包的官网 url 。
   author - 包的作者姓名。
   contributors - 包的其他贡献者姓名。
   dependencies - 依赖包列表。如果依赖包没有安装，npm 会自动将依赖包安装在 node_module 目录下。
   repository - 包代码存放的地方的类型，可以是 git 或 svn，git 可在 Github 上。
   main - main 字段是一个模块ID，它是一个指向你程序的主要项目。就是说，如果你包的名字叫 express，然后用户安装它，然后require("express")。
   keywords - 关键字
</pre>




      
    </div>
    <footer class="article-footer">
      <a data-url="http://blog.yxxit.com/view/2017/03/21/npm/" data-id="cj0ir4g0k0000j4q3ijr5x48b" class="article-share-link">Share</a>
      
      
    </footer>
  </div>
  
</article>


  
    <article id="post-git" class="article article-type-post" itemscope itemprop="blogPost">
  <div class="article-meta">
    <a href="/view/2017/03/21/git/" class="article-date">
  <time datetime="2017-03-20T23:09:31.609Z" itemprop="datePublished">2017-03-21</time>
</a>
    
  </div>
  <div class="article-inner">
    
    
      <header class="article-header">
        
  
    <h1 itemprop="name">
      <a class="article-title" href="/view/2017/03/21/git/">Git 常用命令</a>
    </h1>
  

      </header>
    
    <div class="article-entry" itemprop="articleBody">
      
        <blockquote>
<p>Git是一款免费、开源的分布式版本控制系统，用于敏捷高效地处理任何或小或大的项目。Git是一个开源的分布式版本控制系统，可以有效、高速的处理从很小到非常大的项目版本管理。</p>
</blockquote>
<h2 id="安装"><a href="#安装" class="headerlink" title="安装"></a>安装</h2><h2 id="命令"><a href="#命令" class="headerlink" title="命令"></a>命令</h2><h4 id="拉取远程代码"><a href="#拉取远程代码" class="headerlink" title="拉取远程代码"></a>拉取远程代码</h4><p>git clone <a href="https://github.com/shawflying/reskit.git" target="_blank" rel="external">https://github.com/shawflying/reskit.git</a></p>
<h4 id="拉取分支代码"><a href="#拉取分支代码" class="headerlink" title="拉取分支代码"></a>拉取分支代码</h4><p>git fetch<br>git checkout -b fly origin/fly</p>
<h4 id="查看远程分支"><a href="#查看远程分支" class="headerlink" title="查看远程分支"></a>查看远程分支</h4><p>git branch -r</p>
<h4 id="拉取远程分支并创建本地分支"><a href="#拉取远程分支并创建本地分支" class="headerlink" title="拉取远程分支并创建本地分支"></a>拉取远程分支并创建本地分支</h4><ol>
<li><p>方法1<br>git checkout -b 本地分支名x origin/远程分支名x<br>使用该方式会在本地新建分支x，并自动切换到该本地分支x。</p>
</li>
<li><p>方法2<br>git fetch origin 远程分支名x:本地分支名x<br>使用该方式会在本地新建分支x，但是不会自动切换到该本地分支x，需要手动checkout。</p>
</li>
</ol>
<h4 id="分支合并"><a href="#分支合并" class="headerlink" title="分支合并"></a>分支合并</h4><p>如果无冲突，OK<br>如果有冲突，该如何解决<br>git log –author=”yanxxmh” –after=”1 week ago” –oneline</p>
<h4 id="checkout"><a href="#checkout" class="headerlink" title="checkout"></a>checkout</h4><figure class="highlight plain"><table><tr><td class="gutter"><pre><div class="line">1</div><div class="line">2</div><div class="line">3</div><div class="line">4</div></pre></td><td class="code"><pre><div class="line">git checkout . #本地所有修改的。没有的提交的，都返回到原来的状态</div><div class="line">git stash #把所有没有提交的修改暂存到stash里面。可用git stash pop回复。</div><div class="line">git reset --hard HASH #返回到某个节点，不保留修改。</div><div class="line">git reset --soft HASH #返回到某个节点。保留修改</div></pre></td></tr></table></figure>
<h4 id="拉取制定版本代码"><a href="#拉取制定版本代码" class="headerlink" title="拉取制定版本代码"></a>拉取制定版本代码</h4><ol>
<li>将制定版本闯将一个分支</li>
<li>使用下面命令下载指定分支信息<figure class="highlight plain"><table><tr><td class="gutter"><pre><div class="line">1</div><div class="line">2</div></pre></td><td class="code"><pre><div class="line">git clone -b v1 --depth 1 https://github.com/shawflying/reskit.git</div><div class="line">git clone -b vue.js2.0 --depth 1 https://github.com/shawflying/reskit.git</div></pre></td></tr></table></figure>
</li>
</ol>
<h3 id="切换分支"><a href="#切换分支" class="headerlink" title="切换分支"></a>切换分支</h3><p>查询所有分支<br><figure class="highlight plain"><table><tr><td class="gutter"><pre><div class="line">1</div></pre></td><td class="code"><pre><div class="line">git branch -a</div></pre></td></tr></table></figure></p>
<p>查询当前分支<br><figure class="highlight plain"><table><tr><td class="gutter"><pre><div class="line">1</div></pre></td><td class="code"><pre><div class="line">git branch</div></pre></td></tr></table></figure></p>
<p>切换分支<br><figure class="highlight plain"><table><tr><td class="gutter"><pre><div class="line">1</div><div class="line">2</div><div class="line">3</div><div class="line">4</div><div class="line">5</div></pre></td><td class="code"><pre><div class="line">git checkout devlop</div><div class="line"></div><div class="line">git branch --set-upstream-to=origin/master origin/账单详情添加跳转链接</div><div class="line"></div><div class="line">git branch --set-upstream-to=origin/账单详情添加跳转链接 origin/master</div></pre></td></tr></table></figure></p>
<figure class="highlight plain"><table><tr><td class="gutter"><pre><div class="line">1</div><div class="line">2</div><div class="line">3</div><div class="line">4</div><div class="line">5</div><div class="line">6</div><div class="line">7</div><div class="line">8</div><div class="line">9</div><div class="line">10</div></pre></td><td class="code"><pre><div class="line">root@ubuntu-129:/data/code/mohoo-telecom-wechat-mobile# git pull</div><div class="line">Username for &apos;https://git.coding.net&apos;: xxxxx</div><div class="line">Password for &apos;https://yanxxmh@git.coding.net&apos;: </div><div class="line">remote: Counting objects: 4, done.</div><div class="line">remote: Compressing objects: 100% (3/3), done.</div><div class="line">remote: Total 4 (delta 2), reused 0 (delta 0)</div><div class="line">Unpacking objects: 100% (4/4), done.</div><div class="line">From https://github.com/shawflying/reskit</div><div class="line">   eb8b3be..fa2f6d5  账单详情添加跳转链接 -&gt; origin/账单详情添加跳转链接</div><div class="line">Already up-to-date.</div></pre></td></tr></table></figure>
<p>切换到master<br><figure class="highlight plain"><table><tr><td class="gutter"><pre><div class="line">1</div></pre></td><td class="code"><pre><div class="line">git checkout master</div></pre></td></tr></table></figure></p>
<p>切换到其他<br><figure class="highlight plain"><table><tr><td class="gutter"><pre><div class="line">1</div></pre></td><td class="code"><pre><div class="line">git checkout</div></pre></td></tr></table></figure></p>
<p>拉取代码<br><figure class="highlight plain"><table><tr><td class="gutter"><pre><div class="line">1</div></pre></td><td class="code"><pre><div class="line">git pull &lt;remote&gt; &lt;branch&gt;</div></pre></td></tr></table></figure></p>
<p>当前分支状态<br><figure class="highlight plain"><table><tr><td class="gutter"><pre><div class="line">1</div></pre></td><td class="code"><pre><div class="line">git status</div></pre></td></tr></table></figure></p>

      
    </div>
    <footer class="article-footer">
      <a data-url="http://blog.yxxit.com/view/2017/03/21/git/" data-id="cj0iqbjbu00009oq3af1h49gu" class="article-share-link">Share</a>
      
      
    </footer>
  </div>
  
</article>


  
    <article id="post-windows nginx natapp" class="article article-type-post" itemscope itemprop="blogPost">
  <div class="article-meta">
    <a href="/view/2017/03/05/windows nginx natapp/" class="article-date">
  <time datetime="2017-03-05T13:30:33.636Z" itemprop="datePublished">2017-03-05</time>
</a>
    
  </div>
  <div class="article-inner">
    
    
      <header class="article-header">
        
  
    <h1 itemprop="name">
      <a class="article-title" href="/view/2017/03/05/windows nginx natapp/">windows nginx natapp</a>
    </h1>
  

      </header>
    
    <div class="article-entry" itemprop="articleBody">
      
        <h2 id="实现目标"><a href="#实现目标" class="headerlink" title="实现目标"></a>实现目标</h2><ol>
<li>通过nginx实现本地资源代理</li>
<li>https 学习及使用</li>
<li>方便本地前端服务调试</li>
</ol>
<h2 id="相关环境"><a href="#相关环境" class="headerlink" title="相关环境"></a>相关环境</h2><ul>
<li>windows 7 64</li>
<li>nginx v 1.6</li>
<li><a href="https://natapp.cn" target="_blank" rel="external">natapp</a></li>
<li>phpStudy </li>
<li>阿里云</li>
</ul>
<h2 id="基本操作"><a href="#基本操作" class="headerlink" title="基本操作"></a>基本操作</h2><h3 id="线上配置"><a href="#线上配置" class="headerlink" title="线上配置"></a>线上配置</h3><ol>
<li>注册个人域名</li>
<li>注册natapp</li>
<li>域名和natapp进行绑定</li>
</ol>
<h3 id="nginx-配置"><a href="#nginx-配置" class="headerlink" title="nginx 配置"></a>nginx 配置</h3><p>常用命令</p>
<figure class="highlight plain"><table><tr><td class="gutter"><pre><div class="line">1</div><div class="line">2</div><div class="line">3</div><div class="line">4</div><div class="line">5</div><div class="line">6</div></pre></td><td class="code"><pre><div class="line">nginx -s stop 强制关闭 </div><div class="line">nginx -s quit 安全关闭 </div><div class="line">nginx -s reload 改变配置文件的时候，重启nginx工作进程，来时配置文件生效 </div><div class="line">nginx -t  测试是否成功</div><div class="line"></div><div class="line">.\nginx.exe -t # windows 下要添加.\</div></pre></td></tr></table></figure>
<p><strong>http 代理配置</strong><br><figure class="highlight plain"><table><tr><td class="gutter"><pre><div class="line">1</div><div class="line">2</div><div class="line">3</div><div class="line">4</div><div class="line">5</div><div class="line">6</div><div class="line">7</div><div class="line">8</div><div class="line">9</div><div class="line">10</div><div class="line">11</div><div class="line">12</div><div class="line">13</div><div class="line">14</div><div class="line">15</div><div class="line">16</div><div class="line">17</div><div class="line">18</div><div class="line">19</div><div class="line">20</div></pre></td><td class="code"><pre><div class="line"># 静态页面</div><div class="line">location /html &#123;</div><div class="line">    alias   F:/HTML/year;</div><div class="line">&#125;</div><div class="line"># 端口代理</div><div class="line">location /demo &#123;</div><div class="line">    proxy_pass  http://127.0.0.1:6061;</div><div class="line">&#125;</div><div class="line"># pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000</div><div class="line"># php环境代理</div><div class="line">location ~ \.php(.*)$  &#123;</div><div class="line">	root E:/WWW;# 这里是站点的根目录</div><div class="line">    fastcgi_pass   127.0.0.1:9000;</div><div class="line">    fastcgi_index  index.php;</div><div class="line">    fastcgi_split_path_info  ^((?U).+\.php)(/?.+)$;</div><div class="line">    fastcgi_param  SCRIPT_FILENAME  $document_root$fastcgi_script_name;</div><div class="line">    fastcgi_param  PATH_INFO  $fastcgi_path_info;</div><div class="line">    fastcgi_param  PATH_TRANSLATED  $document_root$fastcgi_path_info;</div><div class="line">    include        fastcgi_params;</div><div class="line">&#125;</div></pre></td></tr></table></figure></p>
<p><strong>https 代理配置</strong> </p>
<figure class="highlight plain"><table><tr><td class="gutter"><pre><div class="line">1</div><div class="line">2</div><div class="line">3</div><div class="line">4</div><div class="line">5</div><div class="line">6</div><div class="line">7</div><div class="line">8</div><div class="line">9</div><div class="line">10</div><div class="line">11</div><div class="line">12</div><div class="line">13</div><div class="line">14</div><div class="line">15</div><div class="line">16</div><div class="line">17</div><div class="line">18</div><div class="line">19</div><div class="line">20</div><div class="line">21</div><div class="line">22</div><div class="line">23</div><div class="line">24</div><div class="line">25</div><div class="line">26</div><div class="line">27</div><div class="line">28</div><div class="line">29</div><div class="line">30</div></pre></td><td class="code"><pre><div class="line">server &#123;</div><div class="line">    listen       443;</div><div class="line">    server_name  localhost;</div><div class="line"></div><div class="line">    ssl                  on;</div><div class="line">    ssl_certificate      https/214009859140175.pem; # ssl 加密文件</div><div class="line">    ssl_certificate_key  https/214009859140175.key; # ssl 加密文件</div><div class="line"></div><div class="line">    ssl_session_timeout  5m;</div><div class="line"></div><div class="line">    ssl_protocols  SSLv2 SSLv3 TLSv1;</div><div class="line">    ssl_ciphers  HIGH:!aNULL:!MD5;</div><div class="line">    ssl_prefer_server_ciphers   on;</div><div class="line"></div><div class="line">    location / &#123;</div><div class="line">        root   html;</div><div class="line">        index  index.html index.htm;</div><div class="line">    &#125;</div><div class="line"></div><div class="line">    # 静态页面</div><div class="line">    location /html &#123;</div><div class="line">        alias   F:/HTML/year;</div><div class="line">    &#125;</div><div class="line"></div><div class="line">    # https 功能测试</div><div class="line">    location /https-demo &#123;</div><div class="line">        proxy_pass  http://127.0.0.1:6061;</div><div class="line">    &#125;</div><div class="line"></div><div class="line">&#125;</div></pre></td></tr></table></figure>
<h3 id="phpStudy-列表"><a href="#phpStudy-列表" class="headerlink" title="phpStudy 列表"></a>phpStudy 列表</h3><p><img src="/view/img/phpStudy.jpg" alt="phpStudy 配置"></p>
<h3 id="Apache-服务配置"><a href="#Apache-服务配置" class="headerlink" title="Apache 服务配置"></a>Apache 服务配置</h3><p><img src="/view/img/Apache-edit.jpg" alt="Apache 环境配置"></p>
<h3 id="php-配置"><a href="#php-配置" class="headerlink" title="php 配置"></a>php 配置</h3><figure class="highlight plain"><table><tr><td class="gutter"><pre><div class="line">1</div></pre></td><td class="code"><pre><div class="line">php-cgi.exe -b 127.0.0.1:9000-c E:\WWW</div></pre></td></tr></table></figure>
<p>不运行上面代码，无法访问php</p>
<h3 id="nssm-开机启动-amp-后台运行"><a href="#nssm-开机启动-amp-后台运行" class="headerlink" title="nssm 开机启动&amp;后台运行"></a>nssm 开机启动&amp;后台运行</h3><figure class="highlight plain"><table><tr><td class="gutter"><pre><div class="line">1</div><div class="line">2</div><div class="line">3</div><div class="line">4</div></pre></td><td class="code"><pre><div class="line">nssm install natapp # 安装服务</div><div class="line">nssm edit natapp # 编辑服务器名</div><div class="line">nssm restart natapp # 重启natapp服务</div><div class="line">nssm remove natapp # 删除XX服务</div></pre></td></tr></table></figure>
<p><img src="/view/img/nssm-edit.jpg" alt="nssm 开机启动&amp;后台运行"><br><img src="/view/img/background-list.jpg" alt="自定义服务"></p>
<h3 id="注意事项"><a href="#注意事项" class="headerlink" title="注意事项"></a>注意事项</h3><ol>
<li><p>window 执行exe</p>
<figure class="highlight plain"><table><tr><td class="gutter"><pre><div class="line">1</div></pre></td><td class="code"><pre><div class="line">.\n</div></pre></td></tr></table></figure>
</li>
<li><p>https 加密文件</p>
<blockquote>
<p>这两块必须要有的，可以到阿里云去申请。</p>
<figure class="highlight plain"><table><tr><td class="gutter"><pre><div class="line">1</div><div class="line">2</div></pre></td><td class="code"><pre><div class="line">ssl_certificate      https/214009859140175.pem; # ssl 加密文件</div><div class="line">ssl_certificate_key  https/214009859140175.key; # ssl 加密文件</div></pre></td></tr></table></figure>
</blockquote>
</li>
<li><p><a href="https://www.aliyun.com" target="_blank" rel="external">阿里云</a>【管理控制台】下【证书服务】</p>
</li>
</ol>
<h2 id="参考"><a href="#参考" class="headerlink" title="参考"></a>参考</h2><ul>
<li><a href="https://natapp.cn" target="_blank" rel="external">natapp</a></li>
<li><a href="https://natapp.cn/article/https" target="_blank" rel="external">支持https泛域名以及本地(443端口)证书,支持http/2协议</a></li>
<li><p><a href="https://natapp.cn/article/windows_service" target="_blank" rel="external">Natapp(Ngrok) Windows下注册为服务,开机启动&amp;后台运行</a></p>
</li>
<li><p><a href="http://nssm.cc/usage" target="_blank" rel="external">nssm 用法</a></p>
</li>
</ul>

      
    </div>
    <footer class="article-footer">
      <a data-url="http://blog.yxxit.com/view/2017/03/05/windows nginx natapp/" data-id="cizwrxbic0000hgddq4j2jcge" class="article-share-link">Share</a>
      
      
    </footer>
  </div>
  
</article>


  
    <article id="post-node.js 模块之 pm2" class="article article-type-post" itemscope itemprop="blogPost">
  <div class="article-meta">
    <a href="/view/2017/02/17/node.js 模块之 pm2/" class="article-date">
  <time datetime="2017-02-17T04:02:41.926Z" itemprop="datePublished">2017-02-17</time>
</a>
    
  </div>
  <div class="article-inner">
    
    
      <header class="article-header">
        
  
    <h1 itemprop="name">
      <a class="article-title" href="/view/2017/02/17/node.js 模块之 pm2/">node.js 模块之 pm2</a>
    </h1>
  

      </header>
    
    <div class="article-entry" itemprop="articleBody">
      
        <h2 id="pm2-简介"><a href="#pm2-简介" class="headerlink" title="pm2 简介"></a>pm2 简介</h2><p>pm2 是一个带有负载均衡功能的Node应用的进程管理器.<br>当你要把你的独立代码利用全部的服务器上的所有CPU，并保证进程永远都活着，0秒的重载， PM2是完美的。它非常适合IaaS结构，但不要把它用于PaaS方案（随后将开发Paas的解决方案）.</p>
<h2 id="常用命令"><a href="#常用命令" class="headerlink" title="常用命令"></a>常用命令</h2><h2 id="pm2-升级"><a href="#pm2-升级" class="headerlink" title="pm2 升级"></a>pm2 升级</h2><figure class="highlight plain"><table><tr><td class="gutter"><pre><div class="line">1</div><div class="line">2</div><div class="line">3</div></pre></td><td class="code"><pre><div class="line">pm2 save</div><div class="line">npm install -g pm2</div><div class="line">pm2 update</div></pre></td></tr></table></figure>
<h3 id="全局安装"><a href="#全局安装" class="headerlink" title="全局安装"></a>全局安装</h3><figure class="highlight plain"><table><tr><td class="gutter"><pre><div class="line">1</div></pre></td><td class="code"><pre><div class="line">npm install -g pm2</div></pre></td></tr></table></figure>
<h3 id="开启进程"><a href="#开启进程" class="headerlink" title="开启进程"></a>开启进程</h3><figure class="highlight plain"><table><tr><td class="gutter"><pre><div class="line">1</div><div class="line">2</div><div class="line">3</div><div class="line">4</div><div class="line">5</div><div class="line">6</div><div class="line">7</div><div class="line">8</div><div class="line">9</div><div class="line">10</div><div class="line">11</div><div class="line">12</div><div class="line">13</div><div class="line">14</div></pre></td><td class="code"><pre><div class="line">pm2 start app.js -i 3 --name node-api # 开启3个名称为node-api的进程</div><div class="line">pm2 start app.js -i max --name node-api # 根据有效CPU数目启动最大进程数目</div><div class="line">pm2 monit # 监视所有进程</div><div class="line">pm2 list # 显示所有进程状态</div><div class="line">pm2 logs node-api # 查看进程日志 默认查看所有</div><div class="line">pm2 stop all # 停止所有进程</div><div class="line">pm2 restart all # 重启所有进程</div><div class="line">pm2 reload all # 0秒停机重载进程 (用于 NETWORKED 进程)</div><div class="line">pm2 delete all # 杀死全部进程</div><div class="line">pm2 startup # 产生 init 脚本 保持进程活着</div><div class="line">pm2 web # 运行健壮的 computer API endpoint (http://localhost:9615)</div><div class="line">pm2 start app.js -x #用fork模式启动 app.js 而不是使用 cluster</div><div class="line">pm2 start app.js -x -- -a 23 # 用fork模式启动 app.js 并且传递参数 (-a 23)</div><div class="line">pm2 start app.json # 启动进程, 在 app.json里设置选项</div></pre></td></tr></table></figure>
<h3 id="支持CoffeeScript"><a href="#支持CoffeeScript" class="headerlink" title="支持CoffeeScript:"></a>支持CoffeeScript:</h3><figure class="highlight plain"><table><tr><td class="gutter"><pre><div class="line">1</div></pre></td><td class="code"><pre><div class="line">pm2 start my_app.coffee</div></pre></td></tr></table></figure>
<h2 id="参考"><a href="#参考" class="headerlink" title="参考"></a>参考</h2><ul>
<li><a href="https://www.douban.com/note/314200231/" target="_blank" rel="external">PM2 介绍</a></li>
<li><a href="https://github.com/Unitech/pm2" target="_blank" rel="external">PM2 官方文档</a></li>
</ul>

      
    </div>
    <footer class="article-footer">
      <a data-url="http://blog.yxxit.com/view/2017/02/17/node.js 模块之 pm2/" data-id="ciz9b0a650000cgdd5t8ywr1z" class="article-share-link">Share</a>
      
      
    </footer>
  </div>
  
</article>


  
    <article id="post-node.js 6.9.4 升级" class="article article-type-post" itemscope itemprop="blogPost">
  <div class="article-meta">
    <a href="/view/2017/02/16/node.js 6.9.4 升级/" class="article-date">
  <time datetime="2017-02-16T08:19:39.593Z" itemprop="datePublished">2017-02-16</time>
</a>
    
  </div>
  <div class="article-inner">
    
    
      <header class="article-header">
        
  
    <h1 itemprop="name">
      <a class="article-title" href="/view/2017/02/16/node.js 6.9.4 升级/">node.js 6.9.4 升级</a>
    </h1>
  

      </header>
    
    <div class="article-entry" itemprop="articleBody">
      
        <h2 id="node-js-简介"><a href="#node-js-简介" class="headerlink" title="node.js 简介"></a>node.js 简介</h2><p>Node.js 是一个基于 Chrome V8 引擎的 JavaScript 运行环境。<br>Node.js 使用了一个事件驱动、非阻塞式 I/O 的模型，使其轻量又高效。<br>Node.js 的包管理器 npm，是全球最大的开源库生态系统。</p>
<h2 id="node-升级"><a href="#node-升级" class="headerlink" title="node 升级"></a>node 升级</h2><p>Node.js的开发非常活跃，它的最新稳定版本也频繁变化，你不时会发现，一个模块不能在你当前的Node版本上使用，此时你需要升级Node</p>
<h2 id="方法一、使用源码，进行编译安装"><a href="#方法一、使用源码，进行编译安装" class="headerlink" title="方法一、使用源码，进行编译安装"></a>方法一、使用源码，进行编译安装</h2><h3 id="下载源码，并上传到服务器"><a href="#下载源码，并上传到服务器" class="headerlink" title="下载源码，并上传到服务器"></a>下载源码，并上传到服务器</h3><figure class="highlight plain"><table><tr><td class="gutter"><pre><div class="line">1</div></pre></td><td class="code"><pre><div class="line">wget https://nodejs.org/dist/v6.9.2/node-v6.9.2-linux-x64.tar.xz</div></pre></td></tr></table></figure>
<h3 id="解压源码"><a href="#解压源码" class="headerlink" title="解压源码"></a>解压源码</h3><figure class="highlight plain"><table><tr><td class="gutter"><pre><div class="line">1</div></pre></td><td class="code"><pre><div class="line">tar xzvf node......gz</div></pre></td></tr></table></figure>
<h3 id="编译安装"><a href="#编译安装" class="headerlink" title="编译安装"></a>编译安装</h3><figure class="highlight plain"><table><tr><td class="gutter"><pre><div class="line">1</div><div class="line">2</div><div class="line">3</div></pre></td><td class="code"><pre><div class="line">./configuration</div><div class="line">make</div><div class="line">make install</div></pre></td></tr></table></figure>
<h3 id="安装完毕"><a href="#安装完毕" class="headerlink" title="安装完毕"></a>安装完毕</h3><figure class="highlight plain"><table><tr><td class="gutter"><pre><div class="line">1</div></pre></td><td class="code"><pre><div class="line">node -v  # 结果：6.9.4</div></pre></td></tr></table></figure>
<h2 id="说明："><a href="#说明：" class="headerlink" title="说明："></a>说明：</h2><ul>
<li>npm 也会同时升级</li>
<li>pm2 也要进行升级</li>
</ul>
<h2 id="方法二、apt-get-升级"><a href="#方法二、apt-get-升级" class="headerlink" title="方法二、apt-get 升级"></a>方法二、apt-get 升级</h2><h3 id="1-设置代理"><a href="#1-设置代理" class="headerlink" title="1. 设置代理"></a>1. 设置代理</h3><figure class="highlight plain"><table><tr><td class="gutter"><pre><div class="line">1</div></pre></td><td class="code"><pre><div class="line">export http_proxy=http://127.0.0.1:808</div></pre></td></tr></table></figure>
<h3 id="apt-get-update-更新系统"><a href="#apt-get-update-更新系统" class="headerlink" title="apt-get update 更新系统"></a>apt-get update 更新系统</h3><figure class="highlight plain"><table><tr><td class="gutter"><pre><div class="line">1</div></pre></td><td class="code"><pre><div class="line">apt-get update</div></pre></td></tr></table></figure>
<h3 id="提示错误"><a href="#提示错误" class="headerlink" title="提示错误"></a>提示错误</h3><figure class="highlight plain"><table><tr><td class="gutter"><pre><div class="line">1</div><div class="line">2</div><div class="line">3</div><div class="line">4</div><div class="line">5</div><div class="line">6</div></pre></td><td class="code"><pre><div class="line">已下载 247 kB，耗时 5秒 (41.5 kB/s)</div><div class="line">正在读取软件包列表... 完成</div><div class="line">W: GPG 错误：http://apt.oneapm.com stable Release: 由于没有公钥，无法验证下列签名： NO_PUBKEY 8CF9B240B421195B</div><div class="line">W: 仓库 “http://apt.oneapm.com stable Release” 没有数字签名。</div><div class="line">N: 无法认证来自该源的数据，所以使用它会带来潜在风险。</div><div class="line">N: 参见 apt-secure(8) 手册以了解仓库创建和用户配置方面的细节</div></pre></td></tr></table></figure>
<h3 id="修复命令"><a href="#修复命令" class="headerlink" title="修复命令"></a>修复命令</h3><figure class="highlight plain"><table><tr><td class="gutter"><pre><div class="line">1</div><div class="line">2</div><div class="line">3</div></pre></td><td class="code"><pre><div class="line">gpg --keyserver pgpkeys.mit.edu --recv-key 8CF9B240B421195B</div><div class="line"></div><div class="line">gpg -a --export  8CF9B240B421195B | sudo apt-key add -</div></pre></td></tr></table></figure>
<h3 id="重新更新源："><a href="#重新更新源：" class="headerlink" title="重新更新源："></a>重新更新源：</h3><figure class="highlight plain"><table><tr><td class="gutter"><pre><div class="line">1</div></pre></td><td class="code"><pre><div class="line">sudo apt-get update</div></pre></td></tr></table></figure>
<h3 id="安装源-更新所有的软件："><a href="#安装源-更新所有的软件：" class="headerlink" title="安装源 更新所有的软件："></a>安装源 更新所有的软件：</h3><figure class="highlight plain"><table><tr><td class="gutter"><pre><div class="line">1</div></pre></td><td class="code"><pre><div class="line">apt-get dist-upgrade</div></pre></td></tr></table></figure>
<h2 id="方法三、-node-切换版本-mvn"><a href="#方法三、-node-切换版本-mvn" class="headerlink" title="方法三、 node 切换版本 mvn"></a>方法三、 node 切换版本 mvn</h2><p>nvm 是 Mac 下的 node 管理工具，有点类似管理 Ruby 的 rvm，如果是需要管理 Windows 下的 node，官方推荐是使用 nvmw 或 nvm-windows 。</p>
<h3 id="一、卸载已安装到全局的-node-npm"><a href="#一、卸载已安装到全局的-node-npm" class="headerlink" title="一、卸载已安装到全局的 node/npm"></a>一、卸载已安装到全局的 node/npm</h3><p>如果之前是在官网下载的 node 安装包，运行后会自动安装在全局目录，其中</p>
<p>node 命令在 /usr/local/bin/node ，npm 命令在全局 node_modules 目录中，具体路径为 /usr/local/lib/node_modules/npm</p>
<p>安装 nvm 之后最好先删除下已安装的 node 和全局 node 模块：</p>
<figure class="highlight plain"><table><tr><td class="gutter"><pre><div class="line">1</div><div class="line">2</div><div class="line">3</div><div class="line">4</div><div class="line">5</div></pre></td><td class="code"><pre><div class="line">npm ls -g --depth=0 #查看已经安装在全局的模块，以便删除这些全局模块后再按照不同的 node 版本重新进行全局安装</div><div class="line"></div><div class="line">sudo rm -rf /usr/local/lib/node_modules #删除全局 node_modules 目录</div><div class="line">sudo rm /usr/local/bin/node #删除 node</div><div class="line">cd  /usr/local/bin &amp;&amp; ls -l | grep &quot;../lib/node_modules/&quot; | awk &apos;&#123;print $9&#125;&apos;| xargs rm #删除全局 node 模块注册的软链</div></pre></td></tr></table></figure>
<h3 id="二、安装-nvm"><a href="#二、安装-nvm" class="headerlink" title="二、安装 nvm"></a>二、安装 nvm</h3><figure class="highlight plain"><table><tr><td class="gutter"><pre><div class="line">1</div></pre></td><td class="code"><pre><div class="line">curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.29.0/install.sh | bash</div></pre></td></tr></table></figure>
<h3 id="三、安装切换各版本-node-npm"><a href="#三、安装切换各版本-node-npm" class="headerlink" title="三、安装切换各版本 node/npm"></a>三、安装切换各版本 node/npm</h3><figure class="highlight plain"><table><tr><td class="gutter"><pre><div class="line">1</div><div class="line">2</div><div class="line">3</div><div class="line">4</div><div class="line">5</div><div class="line">6</div><div class="line">7</div><div class="line">8</div><div class="line">9</div><div class="line">10</div><div class="line">11</div></pre></td><td class="code"><pre><div class="line">nvm install stable #安装最新稳定版 node，现在是 5.0.0</div><div class="line">nvm install 4.2.2 #安装 4.2.2 版本</div><div class="line">nvm install 0.12.7 #安装 0.12.7 版本</div><div class="line"></div><div class="line"># 特别说明：以下模块安装仅供演示说明，并非必须安装模块</div><div class="line">nvm use 0 #切换至 0.12.7 版本</div><div class="line">npm install -g mz-fis #安装 mz-fis 模块至全局目录，安装完成的路径是 /Users/&lt;你的用户名&gt;/.nvm/versions/node/v0.12.7/lib/mz-fis</div><div class="line">nvm use 4 #切换至 4.2.2 版本</div><div class="line">npm install -g react-native-cli #安装 react-native-cli 模块至全局目录，安装完成的路径是 /Users/&lt;你的用户名&gt;/.nvm/versions/node/v4.2.2/lib/react-native-cli</div><div class="line"></div><div class="line">nvm alias default 0.12.7 #设置默认 node 版本为 0.12.7</div></pre></td></tr></table></figure>
<h3 id="四、使用-nvmrc-文件配置项目所使用的-node-版本"><a href="#四、使用-nvmrc-文件配置项目所使用的-node-版本" class="headerlink" title="四、使用 .nvmrc 文件配置项目所使用的 node 版本"></a>四、使用 .nvmrc 文件配置项目所使用的 node 版本</h3><p>如果你的默认 node 版本（通过 nvm alias 命令设置的）与项目所需的版本不同，则可在项目根目录或其任意父级目录中创建 .nvmrc 文件，在文件中指定使用的 node 版本号，例如：</p>
<figure class="highlight plain"><table><tr><td class="gutter"><pre><div class="line">1</div><div class="line">2</div><div class="line">3</div><div class="line">4</div></pre></td><td class="code"><pre><div class="line">cd &lt;项目根目录&gt;  #进入项目根目录</div><div class="line">echo 4 &gt; .nvmrc #添加 .nvmrc 文件</div><div class="line">nvm use #无需指定版本号，会自动使用 .nvmrc 文件中配置的版本</div><div class="line">node -v #查看 node 是否切换为对应版本</div></pre></td></tr></table></figure>
<h3 id="五、nvm-与-n-的区别"><a href="#五、nvm-与-n-的区别" class="headerlink" title="五、nvm 与 n 的区别"></a>五、nvm 与 n 的区别</h3><p>node 版本管理工具还有一个是 TJ 大神的 n 命令，n 命令是作为一个 node 的模块而存在，而 nvm 是一个独立于 node/npm 的外部 shell 脚本，因此 n 命令相比 nvm 更加局限。</p>
<p>由于 npm 安装的模块路径均为 /usr/local/lib/node_modules ，当使用 n 切换不同的 node 版本时，实际上会共用全局的 node/npm 目录。 因此不能很好的满足『按不同 node 版本使用不同全局 node 模块』的需求。</p>
<h3 id="参考"><a href="#参考" class="headerlink" title="参考"></a>参考</h3><p><a href="http://jingyan.baidu.com/article/4853e1e53204251909f7260f.html" target="_blank" rel="external">Ubuntu下如何使用命令行（apt-get）更新软件</a><br><a href="http://blog.csdn.net/loovejava/article/details/21837935" target="_blank" rel="external">更新linux时候提示无法“由于没有公钥，无法验证下列签名 <em>*</em>”的解决方案</a><br><a href="http://www.tuicool.com/articles/Vzquy2" target="_blank" rel="external">使用 nvm 管理不同版本的 node 与 npm</a></p>

      
    </div>
    <footer class="article-footer">
      <a data-url="http://blog.yxxit.com/view/2017/02/16/node.js 6.9.4 升级/" data-id="ciz84palj0000a4ddzgqe0uz6" class="article-share-link">Share</a>
      
      
    </footer>
  </div>
  
</article>


  
    <article id="post-tool/常用工具" class="article article-type-post" itemscope itemprop="blogPost">
  <div class="article-meta">
    <a href="/view/2017/02/10/tool/常用工具/" class="article-date">
  <time datetime="2017-02-10T04:50:54.460Z" itemprop="datePublished">2017-02-10</time>
</a>
    
  </div>
  <div class="article-inner">
    
    
      <header class="article-header">
        
  
    <h1 itemprop="name">
      <a class="article-title" href="/view/2017/02/10/tool/常用工具/">开发常用工具</a>
    </h1>
  

      </header>
    
    <div class="article-entry" itemprop="articleBody">
      
        <h2 id="window-平台下"><a href="#window-平台下" class="headerlink" title="window 平台下"></a>window 平台下</h2><ul>
<li>XMind</li>
<li>Sygwin Terminal</li>
<li>Cmder</li>
<li>GifCam-4.5.CHS</li>
<li>Xshell 5</li>
<li>小书屋</li>
<li>Listary</li>
<li>Visual Studio Code</li>
<li>XMind 7</li>
<li>filezilla 上传工具</li>
<li>navicat 数据库</li>
<li>Google Chrome</li>
<li>Mozilla Firefox</li>
<li>网易闪电邮 and Foxmail</li>
<li>迅雷极速版</li>
<li>PicPick</li>
<li>人生日历</li>
<li>Secure</li>
<li>phpStudy</li>
<li>微信web开发者工具</li>
<li>净网大师</li>
<li>有道云</li>
<li>钉钉</li>
<li>webstorm</li>
<li>sublime</li>
<li>SourceTree</li>
</ul>
<h2 id="浏览器下"><a href="#浏览器下" class="headerlink" title="浏览器下"></a>浏览器下</h2><ol>
<li>Anything to QRcode</li>
<li>JSON Formatter</li>
<li>JSON-handle</li>
<li>Momentum</li>
<li>Octotree</li>
<li>OneTab</li>
<li>Page Ruler</li>
<li>Postman</li>
<li>WEB前端助手(FeHelper)</li>
</ol>
<p>持续维护中。。。</p>

      
    </div>
    <footer class="article-footer">
      <a data-url="http://blog.yxxit.com/view/2017/02/10/tool/常用工具/" data-id="ciyzc6sp600000cddxr9vfqsz" class="article-share-link">Share</a>
      
      
    </footer>
  </div>
  
</article>


  
    <article id="post-node.js下用window.onerror捕获并上报Js错误" class="article article-type-post" itemscope itemprop="blogPost">
  <div class="article-meta">
    <a href="/view/2017/02/09/node.js下用window.onerror捕获并上报Js错误/" class="article-date">
  <time datetime="2017-02-09T05:22:50.011Z" itemprop="datePublished">2017-02-09</time>
</a>
    
  </div>
  <div class="article-inner">
    
    
      <header class="article-header">
        
  
    <h1 itemprop="name">
      <a class="article-title" href="/view/2017/02/09/node.js下用window.onerror捕获并上报Js错误/">node.js下用window.onerror捕获并上报Js错误</a>
    </h1>
  

      </header>
    
    <div class="article-entry" itemprop="articleBody">
      
        <h2 id="使用场景"><a href="#使用场景" class="headerlink" title="使用场景"></a>使用场景</h2><ol>
<li>捕获前端js异常信息，方便后期优化</li>
<li>方便前端交互持续优化</li>
<li>方便问题重现</li>
</ol>
<h2 id="环境"><a href="#环境" class="headerlink" title="环境"></a>环境</h2><ul>
<li>node.js</li>
<li>框架：koa</li>
<li>日志模块：log4js</li>
</ul>
<h2 id="前端代码"><a href="#前端代码" class="headerlink" title="前端代码"></a>前端代码</h2><ol>
<li>使用前端的window.onerror 事件进行监听前端代码的异常。</li>
<li>当前端代码发生异常时，通过post并将异常信息上传服务器。</li>
</ol>
<figure class="highlight js"><table><tr><td class="gutter"><pre><div class="line">1</div><div class="line">2</div><div class="line">3</div><div class="line">4</div><div class="line">5</div><div class="line">6</div><div class="line">7</div><div class="line">8</div><div class="line">9</div><div class="line">10</div><div class="line">11</div><div class="line">12</div></pre></td><td class="code"><pre><div class="line"><span class="built_in">window</span>.onerror = <span class="function"><span class="keyword">function</span>(<span class="params">errorMessage, scriptURI, lineNumber, columnNumber, errorObj</span>) </span>&#123;</div><div class="line">    <span class="keyword">var</span> params = &#123;</div><div class="line">        <span class="attr">errorMessage</span>: errorMessage,</div><div class="line">        <span class="attr">scriptURI</span>: scriptURI,</div><div class="line">        <span class="attr">lineNumber</span>: lineNumber,</div><div class="line">        <span class="attr">columnNumber</span>: columnNumber,</div><div class="line">        <span class="attr">errorObj</span>: errorObj</div><div class="line">    &#125;;</div><div class="line">    $.post(<span class="string">'/yourserver/error'</span>, params, <span class="function"><span class="keyword">function</span>(<span class="params">data</span>) </span>&#123;</div><div class="line">        <span class="built_in">console</span>.log(<span class="built_in">JSON</span>.stringify(data));</div><div class="line">    &#125;);</div><div class="line">&#125;</div></pre></td></tr></table></figure>
<h2 id="后端代码"><a href="#后端代码" class="headerlink" title="后端代码"></a>后端代码</h2><ol>
<li>记录前端异常信息</li>
<li>记录发生异常时设备、浏览器信息</li>
<li>记录发生异常的ip地址</li>
</ol>
<figure class="highlight js"><table><tr><td class="gutter"><pre><div class="line">1</div><div class="line">2</div><div class="line">3</div><div class="line">4</div><div class="line">5</div><div class="line">6</div><div class="line">7</div><div class="line">8</div><div class="line">9</div><div class="line">10</div><div class="line">11</div><div class="line">12</div><div class="line">13</div><div class="line">14</div></pre></td><td class="code"><pre><div class="line"><span class="keyword">var</span> body = <span class="keyword">this</span>.request.body;</div><div class="line"><span class="keyword">var</span> userAgent = <span class="keyword">this</span>.headers[<span class="string">'user-agent'</span>];</div><div class="line"><span class="keyword">var</span> cookie = <span class="keyword">this</span>.headers[<span class="string">'cookie'</span>];</div><div class="line">logger.error(<span class="string">'--------------------前端异常信息----------------------'</span>);</div><div class="line">logger.error(<span class="string">"手机及浏览器环境："</span> + userAgent);</div><div class="line">logger.error(<span class="string">"ip地址："</span> + <span class="keyword">this</span>.ip);</div><div class="line">logger.error(<span class="string">"cookie："</span> + cookie);</div><div class="line">logger.error(<span class="string">"错误信息："</span> + body.errorMessage);</div><div class="line">logger.error(<span class="string">"出错文件："</span> + body.scriptURI);</div><div class="line">logger.error(<span class="string">"出错行号："</span> + body.lineNumber);</div><div class="line">logger.error(<span class="string">"出错列号："</span> + body.columnNumber);</div><div class="line">logger.error(<span class="string">"错误详情："</span> + body.errorObj);</div><div class="line">logger.error(<span class="string">"----------------------end-----------------------------"</span>);</div><div class="line"><span class="keyword">this</span>.body = &#123;<span class="attr">status</span>:<span class="number">200</span>,<span class="attr">data</span>:<span class="string">'ok'</span>&#125;;</div></pre></td></tr></table></figure>
<h2 id="结果"><a href="#结果" class="headerlink" title="结果"></a>结果</h2><p>浏览器端：<br><img src="/view/img/window-err-b.jpg" alt="浏览器端异常信息"></p>
<p>服务器端：<br><img src="/view/img/window.error.png" alt="服务器异常信息"></p>

      
    </div>
    <footer class="article-footer">
      <a data-url="http://blog.yxxit.com/view/2017/02/09/node.js下用window.onerror捕获并上报Js错误/" data-id="ciyxz14uy0000kwddpr4jmltf" class="article-share-link">Share</a>
      
      
    </footer>
  </div>
  
</article>


  
    <article id="post-Spring.boot 项目创建之傻瓜教程" class="article article-type-post" itemscope itemprop="blogPost">
  <div class="article-meta">
    <a href="/view/2017/01/22/Spring.boot 项目创建之傻瓜教程/" class="article-date">
  <time datetime="2017-01-22T15:37:18.014Z" itemprop="datePublished">2017-01-22</time>
</a>
    
  </div>
  <div class="article-inner">
    
    
      <header class="article-header">
        
  
    <h1 itemprop="name">
      <a class="article-title" href="/view/2017/01/22/Spring.boot 项目创建之傻瓜教程/">Spring.boot 项目创建之傻瓜教程</a>
    </h1>
  

      </header>
    
    <div class="article-entry" itemprop="articleBody">
      
        <h2 id="新建项目"><a href="#新建项目" class="headerlink" title="新建项目"></a>新建项目</h2><h4 id="【File】–-gt-【New】–-gt-【Spring-Starter-Project】"><a href="#【File】–-gt-【New】–-gt-【Spring-Starter-Project】" class="headerlink" title="【File】–&gt;【New】–&gt;【Spring Starter Project】"></a>【File】–&gt;【New】–&gt;【Spring Starter Project】</h4><p><img src="/view/img/img-01.jpg" alt="新建项目"></p>
<h4 id="填写项目信息"><a href="#填写项目信息" class="headerlink" title="填写项目信息"></a>填写项目信息</h4><ul>
<li>Name        项目名称</li>
<li>Location     文件位置</li>
<li>Type        选择Maven</li>
<li>Group        com.shaw.wap</li>
<li>Artifact    wap</li>
<li>version    0.0.1-SNAPSHOT</li>
<li>Description    描述</li>
<li>Package    包结构<br><img src="/view/img/img-02.jpg" alt="New Spring Start Project"></li>
</ul>
<h4 id="选择Spring-Boot-版本"><a href="#选择Spring-Boot-版本" class="headerlink" title="选择Spring Boot 版本"></a>选择Spring Boot 版本</h4><p><img src="/view/img/img-03.jpg" alt="New Spring Start Project"></p>
<h4 id="导入架包"><a href="#导入架包" class="headerlink" title="导入架包"></a>导入架包</h4><p><img src="/view/img/img-04.jpg" alt="New Spring Start Project"></p>
<h4 id="项目结构"><a href="#项目结构" class="headerlink" title="项目结构"></a>项目结构</h4><p><img src="/view/img/img-05.jpg" alt="project"></p>
<h4 id="备注"><a href="#备注" class="headerlink" title="备注"></a>备注</h4><p>application.properties     配置信息<br>ShawSpringWapApplication main 方法</p>
<h2 id="启动服务"><a href="#启动服务" class="headerlink" title="启动服务"></a>启动服务</h2><h4 id="创建-HomeController-java"><a href="#创建-HomeController-java" class="headerlink" title="创建 HomeController.java"></a>创建 HomeController.java</h4><p><img src="/view/img/img-06.jpg" alt="创建HomeController"></p>
<figure class="highlight plain"><table><tr><td class="gutter"><pre><div class="line">1</div><div class="line">2</div><div class="line">3</div><div class="line">4</div><div class="line">5</div><div class="line">6</div><div class="line">7</div><div class="line">8</div><div class="line">9</div><div class="line">10</div><div class="line">11</div><div class="line">12</div><div class="line">13</div><div class="line">14</div></pre></td><td class="code"><pre><div class="line">package com.shaw.wap;</div><div class="line"></div><div class="line">import org.springframework.web.bind.annotation.RequestMapping;</div><div class="line">import org.springframework.web.bind.annotation.RequestMethod;</div><div class="line">import org.springframework.web.bind.annotation.RestController;</div><div class="line"></div><div class="line">@RestController</div><div class="line">public class HomeController &#123;</div><div class="line"></div><div class="line">	@RequestMapping(value=&quot;/hello&quot;,method=RequestMethod.GET)</div><div class="line">	public String Say()&#123;</div><div class="line">		return &quot;hello world!&quot;;</div><div class="line">	&#125;</div><div class="line">&#125;</div></pre></td></tr></table></figure>
<h4 id="运行程序"><a href="#运行程序" class="headerlink" title="运行程序"></a>运行程序</h4><p><img src="/view/img/img-07.jpg" alt="运行程序"></p>
<h4 id="范围查看效果"><a href="#范围查看效果" class="headerlink" title="范围查看效果"></a>范围查看效果</h4><p>访问链接：<a href="http://localhost:8080/hello" target="_blank" rel="external">http://localhost:8080/hello</a></p>
<p><img src="/view/img/img-08.jpg" alt="查看结果"></p>

      
    </div>
    <footer class="article-footer">
      <a data-url="http://blog.yxxit.com/view/2017/01/22/Spring.boot 项目创建之傻瓜教程/" data-id="ciy8twqj50000jkddim1ygxid" class="article-share-link">Share</a>
      
      
    </footer>
  </div>
  
</article>


  
    <article id="post-es5" class="article article-type-post" itemscope itemprop="blogPost">
  <div class="article-meta">
    <a href="/view/2017/01/19/es5/" class="article-date">
  <time datetime="2017-01-19T12:32:09.472Z" itemprop="datePublished">2017-01-19</time>
</a>
    
  </div>
  <div class="article-inner">
    
    
      <header class="article-header">
        
  
    <h1 itemprop="name">
      <a class="article-title" href="/view/2017/01/19/es5/">ES5 新增特性汇总</a>
    </h1>
  

      </header>
    
    <div class="article-entry" itemprop="articleBody">
      
        <figure class="highlight plain"><table><tr><td class="gutter"><pre><div class="line">1</div><div class="line">2</div><div class="line">3</div><div class="line">4</div><div class="line">5</div><div class="line">6</div><div class="line">7</div><div class="line">8</div><div class="line">9</div><div class="line">10</div><div class="line">11</div><div class="line">12</div><div class="line">13</div><div class="line">14</div><div class="line">15</div><div class="line">16</div><div class="line">17</div><div class="line">18</div><div class="line">19</div><div class="line">20</div><div class="line">21</div><div class="line">22</div><div class="line">23</div><div class="line">24</div><div class="line">25</div><div class="line">26</div><div class="line">27</div><div class="line">28</div><div class="line">29</div><div class="line">30</div><div class="line">31</div><div class="line">32</div><div class="line">33</div><div class="line">34</div><div class="line">35</div><div class="line">36</div><div class="line">37</div><div class="line">38</div><div class="line">39</div><div class="line">40</div><div class="line">41</div><div class="line">42</div><div class="line">43</div><div class="line">44</div><div class="line">45</div><div class="line">46</div><div class="line">47</div><div class="line">48</div><div class="line">49</div><div class="line">50</div><div class="line">51</div><div class="line">52</div><div class="line">53</div><div class="line">54</div><div class="line">55</div><div class="line">56</div><div class="line">57</div><div class="line">58</div><div class="line">59</div><div class="line">60</div><div class="line">61</div><div class="line">62</div><div class="line">63</div><div class="line">64</div><div class="line">65</div><div class="line">66</div><div class="line">67</div><div class="line">68</div><div class="line">69</div><div class="line">70</div><div class="line">71</div><div class="line">72</div><div class="line">73</div><div class="line">74</div><div class="line">75</div><div class="line">76</div><div class="line">77</div><div class="line">78</div><div class="line">79</div><div class="line">80</div><div class="line">81</div><div class="line">82</div><div class="line">83</div><div class="line">84</div><div class="line">85</div><div class="line">86</div><div class="line">87</div></pre></td><td class="code"><pre><div class="line"></div><div class="line">- Trailing commas are ok</div><div class="line">多余的逗号不报错，比如 &#123;a:1,b:2,&#125;</div><div class="line"></div><div class="line">- No reserved words for property names</div><div class="line">属性名可以使用关键字和保留字了，比如 &#123; if:1, else:2 &#125;</div><div class="line"></div><div class="line">- NaN, Infinity, undefined : are all constants</div><div class="line">NaN、Infinity、undefined 都是常量了，不可更改。</div><div class="line"></div><div class="line">- parseInt() defaults to radix 10</div><div class="line">parseInt 第二个参数默认为 10（真好）</div><div class="line"></div><div class="line">- /regexp/ produces new reg ex object every time</div><div class="line">正则字面量每次都会产生一个新的对象</div><div class="line"></div><div class="line">- JSON.parse(), JSON.stringify()</div><div class="line">添加 JSON 序列化和反序列化</div><div class="line"></div><div class="line">- Function.prototype.bind</div><div class="line">函数新增 bind 方法（贺老说 bind 写在后面有点不好用）</div><div class="line"></div><div class="line">- String.prototype.trim</div><div class="line">字符串终于自带头尾去空格方法了，如 &apos; abc &apos;.trim() === &apos;abc&apos;</div><div class="line"></div><div class="line">- Array.prototype.every, filter, forEach, indexOf, lastIndexOf, map, reduce, reduceRight, some</div><div class="line">数组添加了一系列方法，终于能脱离 Underscore.js 了</div><div class="line"></div><div class="line">- Date.now()</div><div class="line">Date.now 现在才加进来的？可怕。</div><div class="line"></div><div class="line">- Date.prototype.toISOString</div><div class="line">日期新增 toISOString 方法</div><div class="line"></div><div class="line">- new Date(string) and Date.parse(string) will try ISO format 1st</div><div class="line">新增对 ISO 日期格式的支持</div><div class="line"></div><div class="line">- Array.isArray()</div><div class="line">判断一个对象是不是数组……以前苦了大家了</div><div class="line"></div><div class="line">- Object.keys(), Object.create(), Object.defineProperty, Object.defineProperties,</div><div class="line">Object.getOwnPropertyDescriptor(), Object.getOwnPropertyNames(obj), Object.getPrototypeOf(obj)</div><div class="line">- Object.seal(), Object.freeze(), Object.preventExtensions(), Object.isSealed(), Object.isFrozen(),</div><div class="line">Object.isExtensible()</div><div class="line">对象新增一系列方法，使得在 JS 中模拟 Java 变得更丝滑。我最喜欢的还是 Object.create()</div><div class="line"></div><div class="line">- Property attributes: writeable, value, enumerable, configurable, get, set</div><div class="line">对象的属性可以添加各种配置了</div><div class="line"></div><div class="line">- &apos;use strict&apos;;</div><div class="line">- Strict Mode:</div><div class="line">  No more implied global variables within functions.</div><div class="line">  this is not bound to the global object by function form.</div><div class="line">  apply and call do not default to the global object.</div><div class="line">  No with statement.</div><div class="line">  Setting a writeable: false property will throw.</div><div class="line">  Deleting a configurable: false property will throw.</div><div class="line">  Restrictions on eval.</div><div class="line">  eval and arguments are reserved.</div><div class="line">  arguments not linked to parameters.</div><div class="line">  No more arguments.caller or arguments.callee.</div><div class="line">  No more octal literals.</div><div class="line">  Duplicate names in an object literal or function parameters are a syntax error</div><div class="line"></div><div class="line">严格模式</div><div class="line">函数里没有隐式的全局变量了，你要创建全局变量必须是显式的。比如想用 a = 1 创建全局变量是不行的。</div><div class="line">this 不会默认指向全局对象（比如 window 或者 global）了。</div><div class="line">call 和 apply 也不会默认使用全局对象了。</div><div class="line">不准用 with</div><div class="line">如果一个属性的 writeable 是 false，那么你给这个属性赋值就会报错。</div><div class="line">如果一个属性的 configurable 是 false，那么你 delete 这个属性就会报错。</div><div class="line">对 eval 和 arguments 做出了限制。以下代码每行都会报错：</div><div class="line"></div><div class="line">  eval = 17;</div><div class="line">  arguments++;</div><div class="line">  ++eval;</div><div class="line">  var obj = &#123; set p(arguments) &#123; &#125; &#125;;</div><div class="line">  var eval;</div><div class="line">  try &#123; &#125; catch (arguments) &#123; &#125;</div><div class="line">  function x(eval) &#123; &#125;</div><div class="line">  function arguments() &#123; &#125;</div><div class="line">  var y = function eval() &#123; &#125;;</div><div class="line">  var f = new Function(&quot;arguments&quot;, &quot;&apos;use strict&apos;; return 17;&quot;);</div><div class="line">arguments 只保存原始参数。对形参的赋值不会对 arguments 有影响。</div><div class="line">不准用 arguments.caller 和 arguments.callee</div><div class="line">不支持八进制字面量，比如 var a = 015 会报错。</div><div class="line">对象字面量或者函数形参中，如果有重复的名字，就会报错。</div></pre></td></tr></table></figure>
<h2 id="参考"><a href="#参考" class="headerlink" title="参考"></a>参考</h2><ul>
<li><a href="https://zhuanlan.zhihu.com/p/24336831" target="_blank" rel="external">转载</a></li>
</ul>

      
    </div>
    <footer class="article-footer">
      <a data-url="http://blog.yxxit.com/view/2017/01/19/es5/" data-id="ciy4cxh330000ksddol602gtj" class="article-share-link">Share</a>
      
      
    </footer>
  </div>
  
</article>


  
    <article id="post-nodejs开发规范" class="article article-type-post" itemscope itemprop="blogPost">
  <div class="article-meta">
    <a href="/view/2017/01/19/nodejs开发规范/" class="article-date">
  <time datetime="2017-01-19T11:56:53.000Z" itemprop="datePublished">2017-01-19</time>
</a>
    
  </div>
  <div class="article-inner">
    
    
      <header class="article-header">
        
  
    <h1 itemprop="name">
      <a class="article-title" href="/view/2017/01/19/nodejs开发规范/">node.js 开发规范</a>
    </h1>
  

      </header>
    
    <div class="article-entry" itemprop="articleBody">
      
        <h2 id="命名规范"><a href="#命名规范" class="headerlink" title="命名规范"></a>命名规范</h2><h3 id="命名法说明"><a href="#命名法说明" class="headerlink" title="命名法说明"></a>命名法说明</h3><ol>
<li>camel命名法，形如 <code>thisIsAnApple</code></li>
<li>pascal命名法，形如<code>ThisIsAnApple</code></li>
<li>下划线命名法，形如<code>this_is_an_apple</code></li>
<li>中划线命名法，形如<code>this-is-an-apple</code></li>
<li>匈牙利命名法，<code>变量名</code>＝<code>类型</code>＋<code>对象描述</code></li>
</ol>
<h3 id="命名法说明-1"><a href="#命名法说明-1" class="headerlink" title="命名法说明"></a>命名法说明</h3><ol>
<li>变量名：必须使用camel命名法</li>
<li>参数名：必须使用camel命名法</li>
<li>函数名：必须使用camel命名法</li>
<li>方法/属性：必须使用camel命名法</li>
<li>私有（保护）成员：必须以下划线_开头</li>
<li>常量名：必须使用全部大写的下划线命名法，如IS_DEBUG_ENABLED</li>
<li>类名：必须使用pascal命名法</li>
<li>枚举名：必须使用pascal命名法</li>
<li>枚举的属性：必须使用全部大写的下划线命名法</li>
<li>命名空间：必须使用camel命名法</li>
<li>语义：命名同时还需要关注语义，如：<ul>
<li>变量名应当使用名词；</li>
<li>boolean类型的应当使用is、has等起头，表示其类型；</li>
<li>函数名应当用动宾短语；getName</li>
<li>类名应当用名词。Person</li>
</ul>
</li>
</ol>
<h3 id="项目名称"><a href="#项目名称" class="headerlink" title="项目名称"></a>项目名称</h3><figure class="highlight plain"><table><tr><td class="gutter"><pre><div class="line">1</div></pre></td><td class="code"><pre><div class="line">mohoo-telecom-wechat-manager</div></pre></td></tr></table></figure>
<h3 id="文件目录"><a href="#文件目录" class="headerlink" title="文件目录"></a>文件目录</h3><figure class="highlight plain"><table><tr><td class="gutter"><pre><div class="line">1</div></pre></td><td class="code"><pre><div class="line">proxy</div></pre></td></tr></table></figure>
<h3 id="proxy-rest-contr-文件名称"><a href="#proxy-rest-contr-文件名称" class="headerlink" title="proxy,rest,contr 文件名称"></a>proxy,rest,contr 文件名称</h3><figure class="highlight plain"><table><tr><td class="gutter"><pre><div class="line">1</div><div class="line">2</div><div class="line">3</div></pre></td><td class="code"><pre><div class="line">AuthProxy</div><div class="line">AuthRest</div><div class="line">AuthCtrl</div></pre></td></tr></table></figure>
<h3 id="接口地址"><a href="#接口地址" class="headerlink" title="接口地址"></a>接口地址</h3><h3 id="静态资源"><a href="#静态资源" class="headerlink" title="静态资源"></a>静态资源</h3><ol>
<li>js</li>
<li>css: page-alert-span</li>
<li>img: page-icon-add</li>
</ol>
<h3 id="router"><a href="#router" class="headerlink" title="router"></a>router</h3><figure class="highlight plain"><table><tr><td class="gutter"><pre><div class="line">1</div><div class="line">2</div><div class="line">3</div><div class="line">4</div><div class="line">5</div><div class="line">6</div><div class="line">7</div></pre></td><td class="code"><pre><div class="line">router.get(&apos;/index&apos;, auth.authWxUser, home.Index);</div><div class="line">router.get(&apos;/rule&apos;, auth.authWxUser, home.Rule);</div><div class="line"></div><div class="line">router.get(&apos;/query/devicename&apos;, auth.authWxUser, home.deviceName);//查询</div><div class="line">router.get(&apos;/create/record&apos;, auth.authWxUser, home.record);//创建</div><div class="line">router.get(&apos;/update/recordstatus&apos;, auth.authWxUser, home.recordStatus);//修改</div><div class="line">router.get(&apos;/delete/recordbyid&apos;, auth.authWxUser, home.recordById);//删除</div></pre></td></tr></table></figure>
<h3 id="类名，对象名"><a href="#类名，对象名" class="headerlink" title="类名，对象名"></a>类名，对象名</h3><figure class="highlight plain"><table><tr><td class="gutter"><pre><div class="line">1</div><div class="line">2</div><div class="line">3</div><div class="line">4</div><div class="line">5</div><div class="line">6</div><div class="line">7</div><div class="line">8</div><div class="line">9</div><div class="line">10</div></pre></td><td class="code"><pre><div class="line">function Person()&#123;</div><div class="line"></div><div class="line">&#125;</div><div class="line"></div><div class="line">var BillAndPayProxy = &#123;&#125;;</div><div class="line">BillAndPayProxy.getWXPayData = function (param, callback) &#123;</div><div class="line">    httpUtil.post(apis.wxDiscPayUrl, param, function (error, response, content) &#123;</div><div class="line">        callback(error, content);</div><div class="line">    &#125;);</div><div class="line">&#125;;</div></pre></td></tr></table></figure>
<h3 id="方法名称"><a href="#方法名称" class="headerlink" title="方法名称"></a>方法名称</h3><ul>
<li>getName</li>
<li>addUserRecord</li>
<li>get/set, add/remove, create/destroy, start/stop, insert/delete, begin/end。</li>
</ul>
<figure class="highlight plain"><table><tr><td class="gutter"><pre><div class="line">1</div><div class="line">2</div><div class="line">3</div></pre></td><td class="code"><pre><div class="line">var AuthProxy = &#123;&#125;;</div><div class="line"></div><div class="line">AuthProxy.getName();</div></pre></td></tr></table></figure>
<h3 id="私有变量"><a href="#私有变量" class="headerlink" title="私有变量"></a>私有变量</h3><figure class="highlight plain"><table><tr><td class="gutter"><pre><div class="line">1</div><div class="line">2</div><div class="line">3</div><div class="line">4</div><div class="line">5</div><div class="line">6</div><div class="line">7</div><div class="line">8</div><div class="line">9</div><div class="line">10</div><div class="line">11</div><div class="line">12</div></pre></td><td class="code"><pre><div class="line">var AuthProxy = &#123;</div><div class="line">	_name: &apos;&apos;,</div><div class="line">	_age: &apos;&apos;</div><div class="line">&#125;;</div><div class="line">var person = &#123;</div><div class="line">	_setSext: function() &#123;</div><div class="line">		// ...</div><div class="line">	&#125;,</div><div class="line">	_setName: function() &#123;</div><div class="line">		// ...</div><div class="line">	&#125;</div><div class="line">&#125;;</div></pre></td></tr></table></figure>
<h3 id="常量"><a href="#常量" class="headerlink" title="常量"></a>常量</h3><figure class="highlight plain"><table><tr><td class="gutter"><pre><div class="line">1</div><div class="line">2</div></pre></td><td class="code"><pre><div class="line">var PI = &apos;3.1415926&apos;;</div><div class="line">var URL_BIND = &apos;http://wwww.baidu.com&apos;;</div></pre></td></tr></table></figure>
<h3 id="变量"><a href="#变量" class="headerlink" title="变量"></a>变量</h3><blockquote>
<p>总所周知，javascript是一种语法极其灵活的语言。javascript在设计之初就只是用来为HTML添加动态效果的。由于他动态，弱类型等特性，以及不同浏览器的兼容性问题，、<br>造成了开发成本要比java等语言要高很多。正因为它太灵活，我们制定了适用于网易邮箱的javascript编码规范，尽可能多的降低由于语法灵活造成的问题。<br>以下将具体介绍：</p>
</blockquote>
<p>变量名包括<code>全局变量</code>，<code>局部变量</code>，<code>类变量</code>，<code>函数参数</code>等等</p>
<h6 id="基本规范"><a href="#基本规范" class="headerlink" title="基本规范"></a>基本规范</h6><p><code>变量命名</code>都以<code>类型前缀</code>+<code>有意义的单词</code>组成，单词首字母都需要大写。例如：<code>sUserName</code>，<code>nCount</code>。</p>
<h6 id="前缀规范"><a href="#前缀规范" class="headerlink" title="前缀规范"></a>前缀规范</h6><p>每个局部变量都需要有一个类型前缀，按照类型可以分为：</p>
<figure class="highlight plain"><table><tr><td class="gutter"><pre><div class="line">1</div><div class="line">2</div><div class="line">3</div><div class="line">4</div><div class="line">5</div><div class="line">6</div><div class="line">7</div><div class="line">8</div><div class="line">9</div><div class="line">10</div><div class="line">11</div><div class="line">12</div><div class="line">13</div><div class="line">14</div><div class="line">15</div></pre></td><td class="code"><pre><div class="line">s：表示字符串。例如：sName，sHtml;</div><div class="line"></div><div class="line">n：表示数字。例如：nPage，nTotal;</div><div class="line"></div><div class="line">b：表示逻辑。例如：bChecked，bHasLogin;</div><div class="line"></div><div class="line">a：表示数组。例如：aList，aGroup;</div><div class="line"></div><div class="line">r：表示正则表达式。例如：rDomain，rEmail;</div><div class="line"></div><div class="line">f：表示函数。例如：fGetHtml，fInit;</div><div class="line"></div><div class="line">o：表示以上未涉及到的其他对象，例如：oButton，oDate;</div><div class="line"></div><div class="line">g：global 全局变量 例如：gVersion</div></pre></td></tr></table></figure>
<h6 id="例外情况："><a href="#例外情况：" class="headerlink" title="例外情况："></a>例外情况：</h6><p>1：作用域不大临时变量可以简写，比如：str，num，bol，obj，fun，arr。</p>
<p>2：循环变量可以简写，比如：i，j，k等。</p>
<p>为什么需要这样强制定义变量前缀?<br>正式因为javascript是弱语言造成的。在定义大量变量的时候，我们需要很明确的知道当前变量是什么属性，<br>如果只通过普通单词，是很难区分的。</p>
<ol>
<li>函数命名规范</li>
</ol>
<p>统一使用<code>动词</code>或者<code>动词[+名词]</code>形式，例如：fGetVersion()，fSubmitForm()，fInit();<br>涉及返回逻辑值的函数可以使用is，has等表示逻辑的词语代替动词。</p>
<p>如果有内部函数，使用__f+动词[+名词]形式，内部函数必需在函数最后定义。例如：<br><figure class="highlight plain"><table><tr><td class="gutter"><pre><div class="line">1</div><div class="line">2</div><div class="line">3</div><div class="line">4</div><div class="line">5</div><div class="line">6</div><div class="line">7</div><div class="line">8</div><div class="line">9</div><div class="line">10</div><div class="line">11</div><div class="line">12</div></pre></td><td class="code"><pre><div class="line">function fGetNumber(nTotal) &#123;</div><div class="line">	if (nTotal &lt; 100) &#123;</div><div class="line">		nTotal = 100;</div><div class="line">	&#125;</div><div class="line">	return __fAdd(nTotal);</div><div class="line"></div><div class="line">	function __fAdd(nNumber) &#123;</div><div class="line">		nNumber++;</div><div class="line">		return nNumber;</div><div class="line">	&#125;</div><div class="line">&#125;</div><div class="line">fGetNumber(30)</div></pre></td></tr></table></figure></p>
<p>3.其他注意事项</p>
<figure class="highlight plain"><table><tr><td class="gutter"><pre><div class="line">1</div><div class="line">2</div><div class="line">3</div><div class="line">4</div><div class="line">5</div><div class="line">6</div><div class="line">7</div><div class="line">8</div><div class="line">9</div><div class="line">10</div><div class="line">11</div><div class="line">12</div><div class="line">13</div><div class="line">14</div><div class="line">15</div></pre></td><td class="code"><pre><div class="line">1：所有命名最好使用英语表示。</div><div class="line"></div><div class="line">2：所有变量名应该明确而必要，尽量避免不必要的容易混淆的缩写。</div><div class="line"></div><div class="line">3：netease.events.mouse.Handler，而不是 netease.events.mouse.MouseEventHandler。</div><div class="line"></div><div class="line">4：对应的方法应该使用对应的动词，例如：get/set, add/remove, create/destroy, start/stop, insert/delete, begin/end。</div><div class="line"></div><div class="line">5：应该避免双重否定意义的变量，例如：bIsNotError, bIsNotFound，不可取。</div><div class="line"></div><div class="line">6：变量应该在最小的范围内定义，并尽可能的保持最少的活动时间。</div><div class="line"></div><div class="line">7：尽量避免复杂的条件语句，可以使用临时的boolean变量代替。</div><div class="line"></div><div class="line">8：一定要避免在条件中执行语句，例如：if((i=3)&gt;2)&#123;&#125;，不可取。</div></pre></td></tr></table></figure>
<h2 id="匈牙利命名法"><a href="#匈牙利命名法" class="headerlink" title="匈牙利命名法"></a>匈牙利命名法</h2><h3 id="匈牙利命名法语法："><a href="#匈牙利命名法语法：" class="headerlink" title="匈牙利命名法语法："></a>匈牙利命名法语法：</h3><p><code>变量名</code>＝<code>类型</code>＋<code>对象描述</code><br><strong>类型</strong>指变量的类型<br><strong>对象描述</strong>指对象名字全称或名字的一部分，要求有明确含义，命名要容易记忆容易理解。<br>提示: 虽然JavaScript变量表面上没有类型，但是JavaScript内部还是会为变量赋予相应的类型。</p>
<p>提示: 匈牙利命名法是一位微软程序员发明的，多数的C,C++程序都使用此命名法。</p>
<p>JavaScript变量匈牙利命名类型<br>JavaScript变量起名类型    变量命名前缀<br>Array 数组    a<br>Float 浮点    l<br>Function 函数    f<br>Integer(int) 整型    n<br>Object 对象    o<br>Regular Expression 正则    r<br>String 字符串    s<br>g全局变量        g<br>JavaScript变量名匈牙利命名法示例<br><figure class="highlight plain"><table><tr><td class="gutter"><pre><div class="line">1</div></pre></td><td class="code"><pre><div class="line">var sWebURL=&quot;www.jb51.net&quot;;</div></pre></td></tr></table></figure></p>
<p>从变量的名字可以看出s代表字符串WebURL是网址。<br><figure class="highlight plain"><table><tr><td class="gutter"><pre><div class="line">1</div></pre></td><td class="code"><pre><div class="line">var nCheckCount=5;</div></pre></td></tr></table></figure></p>
<p>从变量的名字可以看出n代表Integer(整型)，CheckCount代表某种数量。</p>
<p>使用匈牙利命名法非常简单直观，方便判断变量的类型，而且方便程序的阅读与维护。</p>
<h2 id="限制"><a href="#限制" class="headerlink" title="限制"></a>限制</h2><ol>
<li>尽量不要使用 eval()，冗余产生入侵</li>
<li>缩进 在同一系统中应采用同一种缩进标准，本文提倡缩进大小为4个空格。</li>
<li>花括号{}</li>
<li><p>空格  任何“;”后空一格、for循环中初始化“,”后空一格、数组中”,”后空一格、对象中“:”后空一格、如：</p>
<figure class="highlight plain"><table><tr><td class="gutter"><pre><div class="line">1</div><div class="line">2</div><div class="line">3</div><div class="line">4</div></pre></td><td class="code"><pre><div class="line">for (var i = 0, j = 1; i &lt; 10; i += 1)&#123;</div><div class="line">  var some = [1, 2, 3];</div><div class="line">  var obj = &#123;aa: 1, bb: 2&#125;</div><div class="line">&#125;</div></pre></td></tr></table></figure>
</li>
<li><p>函数参数里“,”后空一格、函数声明中花括号前空一格、函数表达式中括号前后各空一格，如：</p>
<figure class="highlight plain"><table><tr><td class="gutter"><pre><div class="line">1</div><div class="line">2</div><div class="line">3</div></pre></td><td class="code"><pre><div class="line">func(a, b, c)&#123;&#125;;</div><div class="line">function func() &#123;&#125;;</div><div class="line">var func = function () &#123;&#125;;</div></pre></td></tr></table></figure>
</li>
<li><p>所有的操作符前后都跟一个空格，如：</p>
<figure class="highlight plain"><table><tr><td class="gutter"><pre><div class="line">1</div><div class="line">2</div><div class="line">3</div><div class="line">4</div><div class="line">5</div><div class="line">6</div></pre></td><td class="code"><pre><div class="line">var d = 0,</div><div class="line">    a = b + 1;</div><div class="line">if (a &amp;&amp; b &amp;&amp; c) &#123;</div><div class="line">    d = a % c;</div><div class="line">    a += d;</div><div class="line">&#125;</div></pre></td></tr></table></figure>
</li>
<li><p>换行<br>在以下位置必须换行：</p>
<ul>
<li>每个独立语句结束后；</li>
<li>if、else、catch、finally、while等关键字前；</li>
<li>运算符处换行时，运算符必须在新行的行首。</li>
<li>对于因为单行长度超过限制时产生的换行，参考行长度中的策略进行分隔。</li>
</ul>
</li>
<li><p>三元运算符过长</p>
<figure class="highlight plain"><table><tr><td class="gutter"><pre><div class="line">1</div><div class="line">2</div><div class="line">3</div><div class="line">4</div><div class="line">5</div><div class="line">6</div><div class="line">7</div><div class="line">8</div></pre></td><td class="code"><pre><div class="line">//无需换行</div><div class="line">var result = content?result1:result2;</div><div class="line"></div><div class="line">//换行</div><div class="line">var data = _.isEmpty(content)</div><div class="line">  ? _.isEmpty(content2)</div><div class="line">    ?content3:content2</div><div class="line">  :content;</div></pre></td></tr></table></figure>
</li>
</ol>
<h2 id="Interface-接口返回参数规范"><a href="#Interface-接口返回参数规范" class="headerlink" title="Interface 接口返回参数规范"></a>Interface 接口返回参数规范</h2><ol>
<li>接口名称：大驼峰吗？</li>
<li>返回参数，小驼峰<figure class="highlight plain"><table><tr><td class="gutter"><pre><div class="line">1</div><div class="line">2</div><div class="line">3</div></pre></td><td class="code"><pre><div class="line">&#123;status:200,data:&#123;name:&apos;admin&apos;,list:[]&#125;,info:&apos;&apos;&#125;</div><div class="line">&#123;status:0,data:&apos;查询失败&apos;,info:&apos;&apos;&#125;</div><div class="line">&#123;status:5005,data:&apos;服务器繁忙&apos;,info:&apos;&apos;&#125;</div></pre></td></tr></table></figure>
</li>
</ol>
<h2 id="Proxy-代理层"><a href="#Proxy-代理层" class="headerlink" title="Proxy 代理层"></a>Proxy 代理层</h2><ol>
<li>注释：标记入参，出参</li>
<li>将接口参数返回为标准模式参数</li>
<li>在备注中添加，功能简介，<figure class="highlight plain"><table><tr><td class="gutter"><pre><div class="line">1</div><div class="line">2</div><div class="line">3</div><div class="line">4</div><div class="line">5</div><div class="line">6</div><div class="line">7</div><div class="line">8</div><div class="line">9</div><div class="line">10</div><div class="line">11</div><div class="line">12</div><div class="line">13</div><div class="line">14</div><div class="line">15</div></pre></td><td class="code"><pre><div class="line">/**</div><div class="line"> * 录入赠送记录</div><div class="line"> * 1. 通过。。。。</div><div class="line"> * @param params</div><div class="line"> * &#123;&quot;openid&quot;:&quot;微信唯一标识&quot;,&quot;from_deviceno&quot;:&quot;发起人设备号 必传&quot;,&quot;to_deviceno&quot;:&quot;接受人设备号 必传&quot;,&quot;gifts&quot;:&quot;礼物 [50M、100G] 必传&quot;,&quot;type&quot;:&quot;类型 [1]流量 必传&quot;,&quot;remark&quot;:&quot;备注 一个有规则的json串&quot;&#125;</div><div class="line"> * @param callback</div><div class="line"> *  &#123;&quot;data&quot;:&quot;赠送记录唯一标识&quot;,&quot;status&quot;:200,&quot;info&quot;:0&#125;</div><div class="line"> * @constructor</div><div class="line"> */</div><div class="line">GiveFlowProxy.GfCreateGivingGiftsRecord = function (params, callback) &#123;</div><div class="line">    var url = urlKit.GfCreateGivingGiftsRecord;</div><div class="line">    httpUtil.post(url, params, function (error, response, content) &#123;</div><div class="line">        callback(error, content);</div><div class="line">    &#125;);</div><div class="line">&#125;;</div></pre></td></tr></table></figure>
</li>
</ol>
<h2 id="写注释"><a href="#写注释" class="headerlink" title="写注释"></a>写注释</h2><ol>
<li>注释规范</li>
<li>包含那些信息</li>
</ol>
<figure class="highlight plain"><table><tr><td class="gutter"><pre><div class="line">1</div><div class="line">2</div><div class="line">3</div><div class="line">4</div><div class="line">5</div><div class="line">6</div><div class="line">7</div><div class="line">8</div><div class="line">9</div><div class="line">10</div><div class="line">11</div><div class="line">12</div><div class="line">13</div></pre></td><td class="code"><pre><div class="line">/**</div><div class="line"> * 方法名</div><div class="line"> 1. 简要写一下功能操作</div><div class="line"> * @param  &#123;[type]&#125;   param    [description]</div><div class="line"> * @param  &#123;Function&#125; callback [description]</div><div class="line"> * @return &#123;[type]&#125;            [description]</div><div class="line"> */</div><div class="line">BillAndPayProxy.getWXPayData = function (param, callback) &#123;</div><div class="line">    httpUtil.post(apis.wxDiscPayUrl, param, function (error, response, content) &#123;</div><div class="line">        logger.info(&quot;获取微信支付数据返回结果：&quot; + JSON.stringify(param) + JSON.stringify(content));</div><div class="line">        callback(error, content);</div><div class="line">    &#125;);</div><div class="line">&#125;;</div></pre></td></tr></table></figure>
<h2 id="参考"><a href="#参考" class="headerlink" title="参考"></a>参考</h2><ul>
<li><a href="http://www.php100.com/html/webkaifa/javascript/2012/0616/10550.html" target="_blank" rel="external">网易前端JavaScript编码规范</a></li>
<li><a href="http://www.jb51.net/article/87142.htm" target="_blank" rel="external">最全的Javascript编码规范(推荐)</a></li>
<li><a href="http://www.jb51.net/article/22229.htm" target="_blank" rel="external">javascript 命名规则 变量命名规则</a></li>
</ul>

      
    </div>
    <footer class="article-footer">
      <a data-url="http://blog.yxxit.com/view/2017/01/19/nodejs开发规范/" data-id="ciy4cz1or0000r8dd7gh8tygp" class="article-share-link">Share</a>
      
      
  <ul class="article-tag-list"><li class="article-tag-list-item"><a class="article-tag-list-link" href="/view/tags/node-js-规范/">node.js, 规范</a></li></ul>

    </footer>
  </div>
  
</article>


  


  <nav id="page-nav">
    <span class="page-number current">1</span><a class="page-number" href="/view/page/2/">2</a><a class="extend next" rel="next" href="/view/page/2/">__('next') &raquo;</a>
  </nav>
</section>
        
          <aside id="sidebar">
  
    

  
    
  <div class="widget-wrap">
    <h3 class="widget-title">Tags</h3>
    <div class="widget">
      <ul class="tag-list"><li class="tag-list-item"><a class="tag-list-link" href="/view/tags/node-js-规范/">node.js, 规范</a></li></ul>
    </div>
  </div>


  
    
  <div class="widget-wrap">
    <h3 class="widget-title">Tag Cloud</h3>
    <div class="widget tagcloud">
      <a href="/view/tags/node-js-规范/" style="font-size: 10px;">node.js, 规范</a>
    </div>
  </div>

  
    
  <div class="widget-wrap">
    <h3 class="widget-title">Archives</h3>
    <div class="widget">
      <ul class="archive-list"><li class="archive-list-item"><a class="archive-list-link" href="/view/archives/2017/03/">March 2017</a></li><li class="archive-list-item"><a class="archive-list-link" href="/view/archives/2017/02/">February 2017</a></li><li class="archive-list-item"><a class="archive-list-link" href="/view/archives/2017/01/">January 2017</a></li></ul>
    </div>
  </div>


  
    
  <div class="widget-wrap">
    <h3 class="widget-title">Recent Posts</h3>
    <div class="widget">
      <ul>
        
          <li>
            <a href="/view/2017/03/21/npm/">npm 常用命令</a>
          </li>
        
          <li>
            <a href="/view/2017/03/21/git/">Git 常用命令</a>
          </li>
        
          <li>
            <a href="/view/2017/03/05/windows nginx natapp/">windows nginx natapp</a>
          </li>
        
          <li>
            <a href="/view/2017/02/17/node.js 模块之 pm2/">node.js 模块之 pm2</a>
          </li>
        
          <li>
            <a href="/view/2017/02/16/node.js 6.9.4 升级/">node.js 6.9.4 升级</a>
          </li>
        
      </ul>
    </div>
  </div>

  
</aside>
        
      </div>
      <footer id="footer">
  
  <div class="outer">
    <div id="footer-info" class="inner">
      &copy; 2017 coolshaw<br>
      Powered by <a href="http://hexo.io/" target="_blank">Hexo</a>
    </div>
  </div>
</footer>
    </div>
    <nav id="mobile-nav">
  
    <a href="/view/" class="mobile-nav-link">Home</a>
  
    <a href="/view/archives" class="mobile-nav-link">Archives</a>
  
</nav>
    

<script src="//cdn.bootcss.com/jquery/2.2.4/jquery.min.js"></script>


  <link rel="stylesheet" href="/view/fancybox/jquery.fancybox.css">
  <script src="/view/fancybox/jquery.fancybox.pack.js"></script>


<script src="/view/js/script.js"></script>

  </div>
</body>
</html>